import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import LoginHome from '../views/LoginHome.vue'
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path:'/',
    redirect:'/login'
  },
  {
    path:'/login',
    name:"LoginHome",
    component: LoginHome,
  },
  {
    path:'/Home',
    name:"Home",
    component: Home,
    children:[
      {
        path:'/home',
        redirect:'/home/first'
      },
      {
        path:'first',
        component:()=>import ('../views/HomeFirst.vue'),
        meta:{
          index:0,
          reload:1
        }
      },
      {
        path:'warehouse',
        component:()=>import ('../views/Warehouse.vue'), 
        meta:{
          index:1
        }
      },
      {
        path:'order',
        component:()=>import ('../views/Order.vue'), 
        meta:{
          index:1
        } 
      }
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
